package com.ruoyi.pcwl.controller;



import com.ruoyi.common.core.domain.AjaxResult;

import com.ruoyi.pcwl.domain.Carousel;
import com.ruoyi.pcwl.domain.WechatMenu;
import com.ruoyi.pcwl.domain.vo.MenuVo;
import com.ruoyi.pcwl.domain.vo.Result;
import com.ruoyi.pcwl.service.IWechatMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 菜单 前端控制器
 * </p>
 *
 */
@Api(tags = "微信菜单管理接口")
@RestController
@RequestMapping("/wechat/menu")
public class MenuController {

    @Autowired
    private IWechatMenuService menuService;

    /**
     * 新增
     */
    @ApiOperation("新增")
    @PostMapping("/add")
    public Result add(@RequestBody WechatMenu bean) {
        menuService.save(bean);
        return Result.ok(null);
    }

    @ApiOperation(value = "删除菜单")
    @DeleteMapping("removeMenu")
    public AjaxResult removeMenu() {
        menuService.removeMenu();
        return AjaxResult.success();
    }

    @ApiOperation(value = "同步菜单")
    @GetMapping("syncMenu")
    public AjaxResult createMenu() {
        menuService.syncMenu();
        return AjaxResult.success();
    }

    @ApiOperation(value = "获取全部菜单")
    @GetMapping("findMenuInfo")
    public AjaxResult findMenuInfo() {
        List<MenuVo> menuList = menuService.findMenuInfo();
        return AjaxResult.success(menuList);
    }

}

